<% title "Meeting Room Info" %>
<div class="tb_search">
<% form_tag( { :controller => 'meetings',:action => 'show_table' }, :method => 'get') do%> Search room info by date: 
<input type="text" name="date">
<input type="submit" value="Search">
<strong>e.g:</strong> yyyy-mm-dd or 2010-10-10 
<% end %>
</div>

<%= image_tag "cal_info3.png" %>
  
<table class="tb_listing2">
<tr>
<th>Meeting Room </th>
<th>9 - 10 a.m.</th>
<th>10 - 11 a.m.</th>
<th>11 - 12 p.m.</th>
<th>12 - 1 p.m.</th>
<th>1 - 2 p.m.</th>
<th>2 - 3 p.m.</th>
<th>3 - 4 p.m.</th>
<th>4 - 5 p.m.</th>
<th>5 - 6 p.m.</th>
</tr>
<%
#haha = MeetingData.find_all_by_meeting_date(Date.today)
room = MeetingRoom.find(:all)
room.each do |x|
#
#@jan1 = Date.new(Time.now.year,1,21) 
#Jan.find(:all, :conditions => ["meeting_time between ? and ?",@jan1
arr = []
%>
<%#x.meeting_time%>
<tr>
<td><%=x.name%></td>
<%
   today = x.meetings.find_all_by_booking_date(@date)
   today.each do |myx|
     duration = myx.duration.to_i
     0.upto(duration-1) do |x|
      arr << [myx.id, myx.booking_time.hour+x]
     end 
   end
     %>
       <%#arr%><br>
       <%#myc.meeting_time.hour%>
     <%
   
%>

<%

arr1 = []
arr2 = []
arr.collect {|k,v| arr1 << v}
arr.collect {|k,v| arr2 << k}

if arr1.include?9
%>
<td class="off"><%#link_to "Details", meeting_path(2) %></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?10
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?11
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?12
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?13
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?14
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?15
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?16
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>

<%
if arr1.include?17
%>
<td class="off"></td>
<% else %>
<td class="on"></td>
<%end%>
</tr>
<% end %>
</table>
<div class="aligncenter">Date: <strong><%=@date%></strong></div>